<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>修改</title>
    <link href="../../../layuiadmin/js/adm/css/bootstrap.css"  rel="stylesheet">
    <script src="../../../layuiadmin/js/adm/js/vue.js"></script>
    <script src="../../../layuiadmin/js/adm/js/vue-resource.js"></script>
    <script src="../../../layuiadmin/js/adm/js/jquery.min.js"></script>
    <script src="../../../layuiadmin/js/adm/js/bootstrap.js"></script>
    <script src="../../../layuiadmin/js/adm/js/getUrlParam.js"></script>
    <script src="../../../layuiadmin/js/adm/js/date.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui@1.4/lib/theme-default/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui@1.4/lib/index.js"></script>
    <script src="../../../layuiadmin/js/adm/js/jquery.cookie.js"></script>
</head>
<body>
        <h4 style="size: 30px;margin-left: 10%;margin-top: 30px"><b>|基本信息</b></h4>
        <hr style="width: 90%">
    <div id="app"  class="container-fluid" style="margin: 20px 10%">
        
        <div class="row" >
            <label><span style="color: red">*&nbsp;</span>标题：</label>
            <input type="text" v-model="notice.title" class="form-control">
        </div>

        <div class="row" style="margin-top: 25px" >
            <label><span style="color: red">*&nbsp;</span>通知时间</label>
            <input type="date" v-model="notice.datetime" style="width: 50%" class="form-control">
        </div>

        <div class="row"  style="margin-top: 25px" >
            <label><span style="color: red">*&nbsp;</span>通知内容</label>
            <textarea class="form-control" v-model="notice.content" rows="5px"  cols="120px">

            </textarea>
        </div>

        <div class="row"  style="margin-top: 25px" >
           <input type="button" @click="postupdate" value="确定提交" class="btn btn-primary">
        </div>
    </div>
    

    <script>
          var vm=new Vue({
            el:'#app',
            data:{
                notice:{
                    noticeId:"",
                    userId:{
                        userId:"",
                        userName:""
                    },
                    title:"",
                    datetime:"",
                    uploading:"",
                    content:""
                },
                uid:""
            },
            methods: {
                postinfo(id){
                    this.$http.post('http://localhost:8080/adm/upd',{"id":id},{emulateJSON:true}).then(result =>{
                        var dat=eval("("+result.body+")")
                        if(dat!=null&&dat!=""){
                          this.notice=dat
                        }else{
                           alert("获取失败")
                        }
                    })
                },
                postupdate(){
                    var jsons=JSON.stringify(this.notice)
                    this.$http.post('http://localhost:8080/adm/update',{"data":jsons},{emulateJSON:true}).then(result =>{
                        if(result.body=="1"){
                            this.open()
                            
                            
                        }
                    })
                },
                open() {
                    this.$alert('修改成功', '提示消息', {
                    confirmButtonText: '确定',
                    callback: action =>{
                        location.href="adm_notice.html"
                    }
                 })
                },
                
            },
            created () {
                var id = getUrlParam("id")
                this.postinfo(id)
            }
        })      
    </script>

</body>
</html>